package com.foreknow.demo16;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class SetDemo {
    public static void main(String[] args) {

        User u1 = new User();
        u1.setName("fender");
        User u2 = new User();
        u2.setName("fender");
        User u3 = new User();
        u3.setName("fender");



        //1.创建一个set集合
        Set<Integer> set = new HashSet<>();
        //2.向集合当中添加元素
//        set.add(u1);
        set.add(3);
        //3.通过迭代器遍历集合
        Iterator<Integer> it = set.iterator();
        while (it.hasNext()){
            System.out.println(it.toString());

        }

    }
}
